package com.mofeng.myshop.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.mofeng.myshop.domain.dto.base.BaseDto;
import com.mofeng.myshop.domain.po.Command;
import com.mofeng.myshop.domain.po.Setting;
import com.mofeng.myshop.until.MyUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.Accessors;

/**
 * <p>
 * 管理员后台指令设置
 * </p>
 *
 * @author MoFeng
 * @since 2024-04-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder(toBuilder = true)
@Schema(name = "Command 对象", description = "管理员后台指令设置")
@AllArgsConstructor(access = AccessLevel.PUBLIC)
@NoArgsConstructor(access = AccessLevel.PUBLIC)
public class CommandDto extends BaseDto {
    @Schema(description = "管理员命令")
    private String commandValue;

    public Command toCommand() {
        Command command = new Command();
        toBaseEntity(command);
        if (!MyUtil.StringUtil.isEmpty(commandValue)) {
            command.setCommandValue(commandValue);
        }
        return command;
    }
}
